{{if $member_info['loginname'] == ''}}
<script type="text/javascript">
window.location.href="/page_login";
</script>
{{/if}}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>个人中心</title>
    <link rel="stylesheet" href="{{$static_path}}/static/common/css/reset.css">
    <link rel="stylesheet" href="{{$static_path}}/static/common/css/swiper_2.7.css">
    <link rel="stylesheet" href="{{$static_path}}/static/common/css/footer.css">
    <link rel="stylesheet" href="{{$static_path}}/static/css/user/page_user-setup.css">
    <link rel="stylesheet" href="{{$static_path}}/static/common/css/common.css">
    <script src="{{$static_path}}/static/common/js/jquery-1.11.3.js"></script>
</head>

<body>
    <!-- 头部部分 -->
    <div class="user-header">
        {{include file="page_user-header.tpl"}}
    </div>
    <!-- 内容区域 -->
    <div class="user-main">
        <div class="main-content">
            <div class="main-left">
                {{include file="page_user-left.tpl"}}
            </div>
            <div class="main-right">
                <div class="right-user-box">
                    <h1>账户设置</h1>

                </div>
                <!-- 右侧的内容 -->
                <div class="box-txt">

                    <div class="user-sz-go">
                        <h2>头像设置</h2>
                        <div class="upload-user">
                        {{if $member_info['headimgurl'] == ''}}
                            {{if $member_info['sex'] == 1}}
                                <img class="imgUpload" src="{{$static_path}}/static/images/login/head_portrait2.png" alt="">
                            {{else if $member_info['sex'] == 2}}
                                <img class="imgUpload" src="{{$static_path}}/static/images/login/head_portrait1.png" alt="">
                            {{/if}}
                        {{else}}
                            <img class="imgUpload" src="{{$member_info['headimgurl']}}" alt="">
                        {{/if}}
                        </div>
                        <div class="upload-txt">
                            <p>选择喜欢的图片作为您的头像 </p>
                            <p>只可以上传jpg，jpeg，平，gif（静态）格式的图片</p>
                            <div>
                                <div class="upload-go" id="ipt2s">
                                    上传头像
                                </div>
                                <input id="uploadd" name="file" accept="image/*" type="file" style="display: none">
                            </div>
                            
                        </div>

                    </div>

                    <div class="right-box2">
                        <h2>基本信息</h2>
                        <form id="set-info">
                        <ul class="list_name">
                            <li>
                                <div class="nc">
                                    <span>昵称</span>
                                    <input type="text" id="nickname" name="nickname" placeholder="" value="">
                                </div>
                                <div class="ipt2">
                                    <span>性别</span>
                                    <div class="xz">

                                        <div class="female">
                                            <input type="radio" id="female" name="sex" value="1" />
                                            <label for="female"><span class="nan">男</span> </label>
                                        </div>
                                        <div class="male">                
                                            <input type="radio" id="male" name="sex" value="2" />
                                            <label for="male"> <span class="nv">女</span> </label>
                                        </div>
                                    </div>
                                </div>
                            </li>
                            <li class="jj-li2">
                                <span class="sp1">简介</span>
                                <span class="sp2">介绍一下自己，让别人更了解你</span>
                                <button type="button" id="save-info">保存</button>
                            </li>
                            <li class="li3">
                                <textarea id="signature" name="signature" cols="30" rows="10"></textarea>
                            </li>

                        </ul>
                        </form>
                        <form id="modpassword">
                        <div class="last-div">
                            <h2>忘记密码</h2>
                            <p class="ipt1-txt"><span>原密码</span> <input type="password" name="oldpassword"></p>
                            <p class="ipt2-txt"><span>新密码</span> <input type="password" name="password"></p>
                            <p class="ipt3-txt"><span>确认密码</span> <input type="password" name="passwordConfirm"></p>
                            <button type="button" id="modpassword-btn">保存</button>
                        </div>
                        </form>
                    </div>
                </div>


            </div>

        </div>


    </div>

    <!--放一个id为footer的div,把footer.html加载到这块-->
    {{include file="footer.tpl"}}

    <!-- 底部部分 -->
</body>

<script src="{{$static_path}}/static/common/js/slider_upload2.js"></script>
<script src="{{$static_path}}/static/js2/page_user-setup.js"></script>
<!-- 加载头尾 -->

<script type="text/javascript">
    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: "/member/getinfo",
        success: function(data){
            // console.log(data)
            if(data.code == 0){
                // console.log(data.data)
                $('#nickname').val(data.data['nickname'])
                $('#signature').html(data.data['signature'])
                if(data.data['sex'] == 1){
                    $('#female').attr("checked","checked");
                }
                if(data.data['sex'] == 2){
                    $('#male').attr("checked","checked");
                }
            }
        },
        error: function(){
      
        }
    })

    $('#save-info').click(function(){
        var data = $('form#set-info').serialize();
        $.ajax({
            type: 'POST',
            dataType: 'json',
            data: data,
            url: "/member/modinfo",
            success: function(data){
                console.log(data)
                // if(data.code == 0){
                    
                // }
            },
            error: function(){
          
            }
        })
    })

    $('#modpassword-btn').click(function(){
        var data = $('form#modpassword').serialize();
        $.ajax({
            type: 'POST',
            dataType: 'json',
            data: data,
            url: "/member/modpassword",
            success: function(data){
                console.log(data)
                // if(data.code == 0){
                    
                // }
            },
            error: function(){
          
            }
        })
    })
</script>

</html>